<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <% include "../login/header.html" %>


    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <% include "../login/left.html" %>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>版本历史数据</legend>
        </fieldset>
        <div style="padding: 10px;">
                <span class="layui-breadcrumb">
                    <a href="/">首页</a>
                    <a>设备管理  </a>
                    <a><cite>版本历史数据</cite></a>
                </span>
        </div>

        <div id="add-version" style="display: none; margin: 50px 0px 0px 0px">
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 100px">config数据(json格式)</label>
                <div class="layui-input-block">
                    <input type="hidden" id="id"/>
                    <textarea style="width: 400px;height:100px;margin-bottom: 5%" id="config_md5" readonly="readonly"
                              name="config_md5"
                              class="layui-input"></textarea>

                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 100px">base数据(json格式)</label>
                <div class="layui-input-block">
                    <textarea style="width: 400px;height:100px;margin-bottom: 5%" type="text" id="base_line_md5" readonly="readonly"
                              name="base_line_md5"
                              class="layui-input"></textarea>

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 100px">featrue数据(json格式)</label>
                <div class="layui-input-block">
                    <textarea style="width: 400px;height:100px;margin-bottom: 5%" type="text" id="featrue_md5" readonly="readonly"
                              name="featrue_md5"
                              class="layui-input"></textarea>

                </div>
            </div>
        </div>

        <div class="layui-form">
            <div class="layui-form-item" style="padding-top:5px">
                <div class="layui-inline">
                    <label class="layui-form-label">应用名称</label>
                    <div class="layui-input-block">
                        <select name="app_key" id="app_key">
                            <option value="">请选择</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card">

            <div class="layui-card-body">
                <table class="layui-table" lay-skin="nob" id="historyVersionTable" lay-filter="history-version-manage">
                </table>
                <script type="text/html" id="historyBar">
                    <a class="layui-btn layui-btn-normal layui-btn-xs"
                       lay-event="edit"><i
                            class="layui-icon layui-icon-edit"></i>编辑</a>
                </script>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script src="../static/layui/layui.js"></script>
<script src="/static/js/jquery.min.js" media="all"></script>
<script src="../static/assets/js/global.js"></script>

<script>
    var table = '';
    layui.use(['common'], () => {
        table = layui.table;
        var element = layui.element;
        common = layui.common;
        form = layui.form;
        $('#closeBtn').on('click', () => {
            layer.closeAll();
        });
        //加载的时候初始化pingName
        //监听工具条
        table.on('tool(history-version-manage)', function (obj) {
            var data = obj.data;
            $.ajax({
                url: '/historyVersion/getConfig',
                method: 'POST',
                data: {id: data.id},
                success: (result) => {
                    $('#config_md5').val(result.config_md5);
                    $('#base_line_md5').val(result.base_line_md5);
                    $('#featrue_md5').val(result.featrue_md5);
                    $('#id').val(result.id);
                }
            });
            if (obj.event === 'edit') {
                common.showLayer({
                    title: ['修改信息', 'font-size:25px;text-align:center'],
                    width: '600px',
                    height: '500px',
                    name: '#add-version'
                });
            }
        });
    });
    layui.config({
        base: '/static/layuiadmin/historyVersion'
    }).extend({
        historyVersion: '/historyVersionIndex', //主入口模块
    }).use(['historyVersion'], function () {
    });
</script>
</body>
</html>
